import React, { Component } from 'react'
import Tabbar from "./components/tabbar/Tabbar"
import {HashRouter as Router,Route,Redirect,Switch} from "react-router-dom"
import Home from "./components/home/Home"
import Cart from "./components/cart/Cart"
import My from "./components/my/My"
import Category from "./components/category/Category"
import Test from "./components/test/Test"
import SearchCenter from "./components/searchCenter/SearchCenter"
import GoodDetail from "./components/goodDetail/GoodDetail"
import GoodList from "./components/goodList/GoodList"

export default class App extends Component {
  render() {
    return (
      <div>
        <Router>
          <Switch>
            <Route key={1} exact path="/home" render={(props) => <Tabbar {...props}><Home></Home></Tabbar>}></Route>
            <Route key={2} exact path="/category" render={(props) => <Tabbar {...props}><Category></Category></Tabbar>}></Route>
            <Route key={3} exact path="/cart" render={(props) => <Tabbar {...props}><Cart></Cart></Tabbar>}></Route>
            <Route key={4} exact path="/my" render={(props) => <Tabbar {...props}><My></My></Tabbar>}></Route>
            <Route exact path="/test" render={(props)=><Test></Test>}></Route>
            <Route key={5} exact path="/searchCenter" render={(props) => <SearchCenter></SearchCenter>}></Route>
            <Route key={6} exact path="/goodDetail/:id" render={(props) => <GoodDetail></GoodDetail>}></Route>
            <Route key={7} exact path="/goodlist" render={(props) => <GoodList></GoodList>}></Route>
            <Redirect to="/home"></Redirect>
          </Switch>
        </Router>
      </div>
    )
  }
}
